import partServer from './partServer'
class AnimateServer {
  constructor() {
    this.options = {
      paused: false,
      ease: Linear.easeNone // 需要tagcanvas.js
    }
    this.tlArr = []
  }
  createTl(t) {
    let e = new TimelineMax(this.options)
    this.tlArr.push(e)
    e._path = t.path
    e._labels = (t.tlConfig && t.tlConfig.labels) || {}
    e._type = (t.tlConfig && t.tlConfig.type) || 'enter'
    return e
  }
  getCurrentRouteTl(type) {
    let path = partServer.getCurrentContext().$router.currentRoute.path
    return this.tlArr.filter(t => t._path == path).find(e => e._type == type)
  }
}

const animateServer = new AnimateServer()

export default animateServer
